/**
 * 
 */
package org.t2.game.server.module.tips;

import java.util.HashMap;
import java.util.Map;

import org.gaming.service.asserts.ITipCause;

/**
 * @author YY
 */
public enum TipsCode implements ITipCause {
	
	SUCCESS(0, "成功"),
	DESIGN_NOT_FOUND(10001, "配置未找到"),
	REQUEST_FAILED(10002, "处理请求失败"),
	SYNC_FAIL(10003, "未找到同步协议%s的处理函数"),
	GAME_CONTEXT_NOT_LINK(10004, "目标服务器%s未连接"),
	SERVER_OPENED(10005, "服务器已开服"),
	
	PLAYER_OPENID_EMPTY(200001, "账号ID不能为空"),
	PLAYER_SERVER_WRONG(200002, "服务器ID%s不允许进入"),
	PLAYER_NOT_READY(200003, "玩家未完成登陆"),
	PLAYER_LOGIN_AUTH_FAIL(200004, "玩家登录验证失败"),
	PLAYER_NOT_FOUND(200005, "玩家不存在"),
	PLAYER_NICK_SENSITIVE(200006, "昵称中有敏感词汇"),
	PLAYER_NICK_EMPTY(200007, "昵称不能为空"),
	PLAYER_NICK_SAME(200008, "昵称已被占用"),
	PLAYER_SWITCH_ONLY(200009, "账号切换绑定发生重复，一个来源ID只能绑定一个目标ID，一个目标ID只能绑定一个来源ID"),
	
	GIFTCODE_EXPIRE(200010, "礼包码无效"),
	GIFTCODE_USED(200011, "礼包码已被使用"),
	GIFTCODE_USED_SAME(200012, "已使用过同类礼包码"),
	
	
	DATA_ADD_EXPECTION(300001, "数据新增异常，重复的dataId"),
	DATA_UPDATE_EXPECTION(300002, "数据更新异常，重复的dataId"),
	DATA_DELETE_EXPECTION(300003, "数据删除异常，重复的dataId"),
	
	
	RANK_TYPE_ERROR(500001, "排行榜类型参数错误"),
	
	RECHARGE_GIVEN(600001, "该充值订单已发货"),
	RECHARGE_EXCEPTION(600002, "该充值订单处理异常%s"),
	
	MAIL_SYS_REPEATED(700001, "后台邮件重复发送"),
	MAIL_SYS_EXCEPTION(700002, "后台邮件发送异常%s"),
	MAIL_NOT_EXIST(700002, "未找到ID为%s的邮件"),
    MAIL_RECEIVES(700003, "附件已领取"),
    MAIL_NO_ATTACHMENT(700004, "该邮件没有附件"),
    MAIL_NO_RECEIVES(700005, "附件未领取"),
    MAIL_UNREAD(700006, "邮件未读"),
    MAIL_CAPACITY_LIMIT(700007,"背包容量已到达上限，请清理背包"),
    MAIL_NO_REWARD(700008, "邮件中没有奖励可以领取"),
	
    GM_NOT_AVAILABLE(800001, "(╯‵□′)╯︵┻━┻"),
    
	;
	public static Map<Integer, TipsCode> codes = new HashMap<>();
	static {
		for (TipsCode code : TipsCode.values()) {
			codes.put(code.getCode(), code);
		}
	}
	public static TipsCode valueOf(int code) {
		return codes.get(code);
	}
	
    private final int code;
    private final String message;

    private TipsCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
